Skip to content

fix: make role optional in messages#45

Open
Rohith Ramakrishnan (MadaraUchiha-314) wants to merge 1 commit intolangchain-ai:mainfrom
MadaraUchiha-314:making-role-optional
Open

fix: make role optional in messages#45
Rohith Ramakrishnan (MadaraUchiha-314) wants to merge 1 commit intolangchain-ai:mainfrom
MadaraUchiha-314:making-role-optional

Conversation

@MadaraUchiha-314
Copy link
Copy Markdown
Contributor

@MadaraUchiha-314 Rohith Ramakrishnan (MadaraUchiha-314) commented Apr 4, 2025

  • Makes the role attribute in Message optional
  • Many types included in AnyMessage don't have role in it. This makes it difficult for anyone implementing the protocol to send a response back as there's validation failure when AnyMessage is converted to Message

Copy link
Copy Markdown
Contributor

@nfcampos Nuno Campos (nfcampos) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a message has no role how do you distinguish it from other message types?

@MadaraUchiha-314
Copy link
Copy Markdown
Contributor Author

If a message has no role how do you distinguish it from other message types?

Are you talking about message.type or message.role

In langgraph provided message interfaces like HumanMessage, ChatMessage and BaseMessage, they all have the attribute called type

role is not present in most of them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants